CATE={
    "泵供水不足":{
        "fields": ["进口压力", "瞬时流量", "出口压力","泵平衡压力"],
        "label":{
            "errorUp":1,
            "errorDown":2,
            "warnUp":3,
            "warnDown":4,
        }
    },
    "泵润滑故障": {
        "fields": ["润滑油压力", "高架油箱液位", "地下油箱液位", "泵润滑油压力","泵前轴温度","泵后轴温度","前轴承温度","后轴承温度"],
        "label": {
            "errorUp": 5,
            "errorDown": 6,
            "warnUp": 7,
            "warnDown": 8,
        }
    },
    "电机运行故障":{
        "fields":["A相电压","B相电压","C相电压","A相电流","B相电流","C相电流","有功功率","无功功率","定子前部温度","定子中部温度","定子后部温度","前轴承温度","后轴承温度","电机冷却水压力","电机润滑油压力"],
        "label":{
            "errorUp": 9,
            "errorDown": 10,
            "warnUp": 11,
            "warnDown": 12,
        }
    }
}

def findCateByLabel(n):
    for errorKind in CATE:
        for key in CATE[errorKind]['label']:
            if CATE[errorKind]['label'][key]==n:
                return errorKind,key
    return None,None

def getErrorCateNum():
    return len(CATE)*4